﻿using Ceremony.API.Model;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Ceremony.API.Infrastructure.EntityConfigurations
{
    public class WhisperEntityTypeConfiguration
        : IEntityTypeConfiguration<Whisper>
    {
        public void Configure(EntityTypeBuilder<Whisper> builder)
        {
            builder.ToTable("Whisper");

            builder.HasKey(ci => ci.Id);

            builder.Property(ci => ci.Id)
               .UseHiLo("whisper_hilo")
               .IsRequired();

            builder.Property(cb => cb.UserId)
                .IsRequired(true);
            builder.Property(cb => cb.Message)
               .IsRequired(false)
               .HasMaxLength(500);
            builder.Property(cb => cb.CreateTime)
               .IsRequired(true);
            
        }
    }
}
